##################################################################
###                    Glare3D Demo Browser                    ###
##################################################################

# set some CMake module paths
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/__CMake__)

# enable Folders4CMake
set (folders4cmake_path ${CMAKE_SOURCE_DIR}/__CMake__/folders4cmake.jar)
include (folders4cmake)

if (ANDROID)
	set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -fPIC")
	set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/android/libs/armeabi-v7a/)
endif ()

# include the source file list generated by Folders4CMake
include (Demo.Browser_src_files)

set (INCLUDE_DIRS
	${CFG_FILE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_SOURCE_DIR}/Libraries/glare.math/include
    ${CMAKE_SOURCE_DIR}/Libraries/glare.core/include
    ${CMAKE_SOURCE_DIR}/Libraries/glare.d3d11/include
    ${CMAKE_SOURCE_DIR}/Libraries/glare.gles2/include
    ${DEPENDENCY_POWER_VR_INCLUDE_DIR}
	${DEPENDENCY_DIRECTX_INCLUDE_DIR}
)

set (LINK_DIRS
    ${DEPENDENCY_POWER_VR_LIB_DIR}
	${DEPENDENCY_DIRECTX_LIB_DIR}
)

set (LIBRARIES
    glare.core
    glare.gles2
)

if (WIN32)
	set (LIBRARIES ${LIBRARIES} glare.d3d11)
endif ()

if (ANDROID)
	set (LIBRARIES 
		${LIBRARIES}
		android
		GLESv2
		EGL
		log
	)
endif ()

include_directories(${INCLUDE_DIRS})

link_directories(${LINK_DIRS})

add_application(Demo.Browser WIN32 SOURCES ${file_root})
set_property(TARGET Demo.Browser PROPERTY FOLDER ${PROJECT_APPLICATIONS_FOLDER})

auto_rebuild_src_files (Demo.Browser)

target_link_libraries(Demo.Browser ${LIBRARIES})

if (WIN32)
	copy_post_build (Demo.Browser "${DEPENDENCY_POWER_VR_LIB_DIR}/libEGL.dll")
	copy_post_build (Demo.Browser "${DEPENDENCY_POWER_VR_LIB_DIR}/libGLESv2.dll")
endif()
